module SoftRenderer {
	export class Engine {
		constructor () {
    	}

		public loadJsonDataAsync (url:string, success:(data:any) => any, failed:() => any) :void {
   			var xhr = new XMLHttpRequest();
   			xhr.open("GET", url, true);
   			xhr.onreadystatechange = function () {
       			if (xhr.readyState == 4 && xhr.status == 200) {
           			var jsonObject = JSON.parse(xhr.responseText);
           			success(jsonObject);
       			}
       			else {
       				failed();
       			}
		   	};
   			xhr.send(null);
		}
	}    
}
